﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp3
{
    using System;
    using System.Collections.Generic;


    interface IShape
    {
        double CalculateArea();
        bool IsValid();
    }

    abstract class Shape : IShape
    {
        public abstract double CalculateArea();

        public abstract bool IsValid();
    }

    class Rectangle : Shape
    {
        private double length;
        private double width;

        public Rectangle(double length, double width)
        {
            this.length = length;
            this.width = width;
        }

        public override double CalculateArea()
        {
            return length * width;
        }

        public override bool IsValid()
        {
            return length > 0 && width > 0;
        }
    }

    class Square : Shape
    {
        private double side;

        public Square(double side)
        {
            this.side = side;
        }

        public override double CalculateArea()
        {
            return side * side;
        }

        public override bool IsValid()
        {
            return side > 0;
        }
    }

    class Circle : Shape
    {
        private double radius;

        public Circle(double radius)
        {
            this.radius = radius;
        }

        public override double CalculateArea()
        {
            return Math.PI * radius * radius;
        }

        public override bool IsValid()
        {
            return radius > 0;
        }


    }
}
